package com.tourism.home.controller.user;

import com.tourism.home.entity.Result;
import com.tourism.home.service.ReportService;
import com.tourism.home.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class ReportController {

    @Autowired
    ReportService reportService;

    //ok
    @PutMapping("/report/user")
    Result addReportU(@RequestParam("content") String content, @RequestParam("ouid") Integer ouid, @RequestParam("uid") Integer uid){
        return ResultUtil.success(reportService.addReportU(content,ouid,uid));
    }
    //ok
    @PutMapping("/report/post")
    Result addReportP(@RequestParam("content") String content, @RequestParam("pid") Integer pid, @RequestParam("uid") Integer uid){
        return ResultUtil.success(reportService.addReportP(content,pid,uid));
    }

    @GetMapping("/report/post/uids/{pid}")
    Result getReportPostUIDs(@PathVariable("pid") Integer pid){
        return ResultUtil.success(reportService.getReportPostUIDs(pid));
    }
    @GetMapping("/report/user/uids/{ouid}")
    Result getReportUserUIDs(@PathVariable("ouid") Integer ouid){
        return ResultUtil.success(reportService.getReportUserUIDs(ouid));
    }
}
